package com.jackson.engineeringtechnologyguide.event;

/*
 * Author: JacksonCoder
 * FileName: PushEventPublisher
 * Version: 1.0.0
 * Date: 2025/1/11
 */

import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.stereotype.Component;

@Slf4j
@Component
@RequiredArgsConstructor
public class PushEventPublisher {

    private final ApplicationContext applicationContext;
    private final ApplicationEventPublisher publisher;

    /**
     * 事件发布
     */
    public void publish(PushEventMessage message) {
        applicationContext.publishEvent(new PushEvent(message));
        publisher.publishEvent(new PushEvent(message));
    }

}
